require 'scanner/states/state'
require 'scanner/states/start_state'

class CommentLineState < State
  @token_type = :CommentLine

  def self.on_enter(token, char)
    literal = ""
    literal = token.literal unless token.nil?
    literal << char.to_s
    # Remove leading slashes
    if literal[0..1] == "//"
      literal = literal[2..-1]
    end
    @token = Token.new(@token_type, "#{literal}")
  end

  def self.next_state(char)
    if char == nil or char == "\n"
      return StartState
    else
      return CommentLineState
    end
  end
end